package t10086.Configure;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;

@Configuration
public class WebSocketConfig {
    @Bean
    public ServletServerContainerFactoryBean createWebSocketContainer() {
        ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
        // 设置文本消息缓冲区大小（单位：字节）
        container.setMaxTextMessageBufferSize(1024 * 1024); // 1MB
        // 设置二进制消息缓冲区大小（单位：字节）
        container.setMaxBinaryMessageBufferSize(1024 * 1024); // 1MB
        return container;
    }
}
